package com.poc;

import java.lang.management.ManagementFactory;

import javax.management.InstanceAlreadyExistsException;
import javax.management.MBeanRegistrationException;
import javax.management.MBeanServer;
import javax.management.MalformedObjectNameException;
import javax.management.NotCompliantMBeanException;
import javax.management.ObjectName;

import com.poc.mxbeans.impl.EmployeeData;

public class App {
	public static void main(String[] args) {
		MBeanServer platformMBeanServer = ManagementFactory
				.getPlatformMBeanServer();
		EmployeeData employeeData = new EmployeeData();
		try {
			platformMBeanServer.registerMBean(employeeData, new ObjectName(
					"com.poc:type=EmployeeData"));
			Thread.sleep(Long.MAX_VALUE);
		} catch (InstanceAlreadyExistsException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (MBeanRegistrationException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (NotCompliantMBeanException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (MalformedObjectNameException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}
}
